<?php
/**
 * Created by PhpStorm.
 * Author: ls
 * Time: 2023/8/31 9:40
 * Desc: 退款申请待审核-邮件
 */

class Listener_Order_Reviewing_Email extends Listener_Base
{
    public function handle($args)
    {
        $self       = new self();
        $self->args = $args;
        //判断队列是否开启,如果开启则把任务推送到队列
        if ($self->queue_status) {
            //推送到队列执行
            Queue::in('default', Listener_Order_Reviewing_Email::class, $args);
        } else {
            $self->perform();
        }

    }

    public function perform()
    {
        $args      = $this->args;
        $order    = $args['order'];
        if ($order) {
            $result = St_EmailService::send_product_order_email(St_NoticeCommon::PRODUCT_ORDER_REVIEWING_MSGTAG, $order);
            St_Log::write('邮件通知', array('ordersn' => $order['ordersn'], 'result' => $result), 'event/order_reviewing/log');
        }
    }

}